package com.friday.util;


import com.alibaba.fastjson.JSONArray;

public final class Trans {
    public static String QuotDtoE(String status){
        String result="未回复";
        switch (status){
            case "success":
                result="通过";
                break;
            case "fail":
                result="驳回";
                break;
            case "pending":
                result="未回复";
                break;
            case "expired":
                result="已失效";
                break;
        }
        return result;
    }

    public static String QuotEtoD(String status){
        String result="pending";
        switch (status){
            case "通过":
                result="success";
                break;
            case "驳回":
                result="fail";
                break;
            case "未回复":
                result="pending";
                break;
            case "已失效":
                result="expired";
                break;
        }
        return result;
    }

    public static String InquDtoE(String status){
        String result="未回复";
        switch (status){
            case "finished":
                result="已完成";
                break;
            case "pending":
                result="未回复";
                break;
            case "expired":
                result="已失效";
                break;
        }
        return result;
    }

    public static double stockScore(JSONArray in, JSONArray out){
        double sum1=0;
        double sum2=0;
        for(int i=0;i<in.size();i++){
            sum1+=Math.pow(in.getInteger(i),2);
            sum2+=Math.pow(out.getInteger(i),2);
        }
        double result=Math.sqrt(sum1/sum2)*0.75;
        return result*100;
    }


}
